'''
	The system OutputController allows a third party to listen to events in a
	controlled manner. A third party should inherit this class and override the
	desired methods. 
	
	@author: J.Teeuw
	@copyright: Twente University
'''
from wx.lib.pubsub import Publisher


# class definition
class OutputController:
	'''
		The class captures all model events and some gui events. The class can 
		be used for example to create loggers and recorders. (How they are 
		currently used. The events are provided in multiple level coarseness. 
		
		Level 1 events are quite coarse, and level 3 events are very precise. 
		Level 1 and 2 have detailed documentation. Level 3 events have less 
		documentation due to their sheer quantity.
		
		For details on how to use this class see the developer manual. Beware
		that some methods are never called since the system doesn't have to 
		implement all these functions.
		@version: 1.0
	'''
	
	def __init__(self):
		
		
		# Level 1: Coarse Instrument Events
		Publisher.subscribe(self._instrumentAdded, "InstrumentAdded")
		Publisher.subscribe(self._instrumentUpdated, "InstrumentUpdated")
		Publisher.subscribe(self._instrumentRemoved, "InstrumentRemoved")
		
		Publisher.subscribe(self._instrumentStartRecording, "InstrumentStart")
		Publisher.subscribe(self._instrumentStopRecording, "InstrumentStop")
				
		# Level 2: More Refined Instrument Events
		Publisher.subscribe(self._instrumentPositionUpdated, "InstrumentPosition")
		Publisher.subscribe(self._instrumentScaleUpdated, "InstrumentScale")
		Publisher.subscribe(self._instrumentOrientationUpdated, "InstrumentOrientation")
		Publisher.subscribe(self._instrumentColorUpdated, "InstrumentColor")
		Publisher.subscribe(self._instrumentOpacityUpdated, "InstrumentOpacity")
		Publisher.subscribe(self._instrumentVisibilityUpdated, "InstrumentVisibility")
		Publisher.subscribe(self._instrumentLabelUpdated, "InstrumentLabel")
		
		# Level 3: Most Refined Instrument Events
		Publisher.subscribe(self._instrumentPositionXUpdated, "InstrumentPositionX")
		Publisher.subscribe(self._instrumentPositionYUpdated, "InstrumentPositionY")
		Publisher.subscribe(self._instrumentPositionZUpdated, "InstrumentPositionZ")
		Publisher.subscribe(self._instrumentScaleXUpdated, "InstrumentScaleX")
		Publisher.subscribe(self._instrumentScaleYUpdated, "InstrumentScaleY")
		Publisher.subscribe(self._instrumentScaleZUpdated, "InstrumentScaleZ")
		Publisher.subscribe(self._instrumentOrientationXUpdated, "InstrumentOrientationX")
		Publisher.subscribe(self._instrumentOrientationYUpdated, "InstrumentOrientationY")
		Publisher.subscribe(self._instrumentOrientationZUpdated, "InstrumentOrientationZ")
		Publisher.subscribe(self._instrumentColorRUpdated, "InstrumentColorR")
		Publisher.subscribe(self._instrumentColorGUpdated, "InstrumentColorG")
		Publisher.subscribe(self._instrumentColorBUpdated, "InstrumentColorB")
		
		# Level 1: Coarse Geom Events
		Publisher.subscribe(self._geomAdded, "GeomAdded")
		Publisher.subscribe(self._geomUpdated, "GeomUpdated")
		Publisher.subscribe(self._geomRemoved, "GeomRemoved")
		
		Publisher.subscribe(self._geomHighlighted, "GeomHighlighted")
		Publisher.subscribe(self._geomPicked, "GeomPicked")
		
		# Level 2: More Refined Geom Events
		Publisher.subscribe(self._geomPositionUpdated, "GeomPosition")
		Publisher.subscribe(self._geomScaleUpdated, "GeomScale")
		Publisher.subscribe(self._geomOrientationUpdated, "GeomOrientation")
		Publisher.subscribe(self._geomColorUpdated, "GeomColor")
		Publisher.subscribe(self._geomOpacityUpdated, "GeomOpacity")
		Publisher.subscribe(self._geomVisibilityUpdated, "GeomVisibility")
		Publisher.subscribe(self._geomLabelUpdated, "GeomLabel")
		
		# Level 3: Most Refined Geom Events
		Publisher.subscribe(self._geomPositionXUpdated, "GeomPositionX")
		Publisher.subscribe(self._geomPositionYUpdated, "GeomPositionY")
		Publisher.subscribe(self._geomPositionZUpdated, "GeomPositionZ")
		Publisher.subscribe(self._geomScaleXUpdated, "GeomScaleX")
		Publisher.subscribe(self._geomScaleYUpdated, "GeomScaleY")
		Publisher.subscribe(self._geomScaleZUpdated, "GeomScaleZ")
		Publisher.subscribe(self._geomOrientationXUpdated, "GeomOrientationX")
		Publisher.subscribe(self._geomOrientationYUpdated, "GeomOrientationY")
		Publisher.subscribe(self._geomOrientationZUpdated, "GeomOrientationZ")
		Publisher.subscribe(self._geomColorRUpdated, "GeomColorR")
		Publisher.subscribe(self._geomColorGUpdated, "GeomColorG")
		Publisher.subscribe(self._geomColorBUpdated, "GeomColorB")
		
		# initialize controler
	def __del__(self):
		'''
			Destructor.
		'''
		pass
		

		
	
	#####
	# Level 1: Coarse Instrument Events
	#####
	
	def InstrumentAdded(self, instrument):
		'''
			Is called when a instrument is added.
			
			@param instrument: instrument that was added.
		'''
		pass
	
	
	def InstrumentUpdated(self, instrument):
		'''
			Is called when a instrument is updated.
			
			@param instrument: instrument that was updated.
		'''
		pass
	
	
	def InstrumentRemoved(self, instrument):
		'''
			Is called when a instrument is removed.
			
			@param instrument: instrument that was removed.
		'''
		pass
	
	
	def InstrumentStartRecording(self, instrument):
		'''
			Is called when an instrument starts recording.
			
			@param instrument: that starts recording.
		'''
		pass
	
	
	def InstrumentStopRecording(self, instrument):
		'''
			Is caled when an instrument stops recording.
			
			@param instrument: that stops recording.
		'''
		pass
	
	
	#####
	# Level 2: More Refined Instrument Events
	#####
	
	def InstrumentPositionUpdated(self, instrument):
		'''
			The position of an instrument is updated.
			
			@param instrument: Updated instrument.
		'''
		pass
		
	
	def InstrumentScaleUpdated(self, instrument):
		'''
			The scale of an instrument is updated.
			
			@param instrument: Updated instrument.
		'''
		pass
		
	
	def InstrumentOrientationUpdated(self, instrument):
		'''
			The orientation of an instrument is updated.
			
			@param instrument:  Updated instrument.
		'''
		pass
		
	
	def InstrumentColorUpdated(self, instrument):
		'''
			The color of an instrument is updated.
			
			 @param instrument: I Updated instrument. 
		'''
		pass
		
	
	def InstrumentOpacityUpdated(self, instrument):
		'''
			The opacity of an instrument is updated.
			
			@param instrument:  Updated instrument.
		'''
		pass
		
	
	def InstrumentVisibilityUpdated(self, instrument):
		'''
			The visibility of an instrument is updated.
			
			@param instrument:  Updated instrument.
		'''
		pass
		
		
	#
	def InstrumentLabelUpdated(self, instrument):
		'''
			The label of an instrument is updated.
			
			@param instrument:  Updated instrument.
		'''
		pass
	
	
	#####
	# Level 3: Most Refined Instrument Events
	#####
	
	
	def InstrumentPositionXUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument:  Updated instrument.
		'''
		pass
		
		
	def InstrumentPositionYUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
		
	
	#
	def InstrumentPositionZUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
		
	
	#
	def InstrumentScaleXUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
		
		
	#
	def InstrumentScaleYUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
		
	
	#
	def InstrumentScaleZUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
	
	
	#
	def InstrumentOrientationXUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
		
		
	#
	def InstrumentOrientationYUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
		
	
	#
	def InstrumentOrientationZUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
		
	
	#
	def InstrumentColorRUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
		
		
	#
	def InstrumentColorGUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
		
	
	#
	def InstrumentColorBUpdated(self, instrument):
		'''
			Detailed level 3 event. 
			
			@param instrument: Updated instrument.
		'''
		pass
		
		
	#####
	# Level 1: Coarse Geom Events
	#####
	
	def GeomAdded(self, geom):
		'''
			Is called when a geom is added.
			
			@param geom: Geom that was added.
		'''
		pass
	
	
	def GeomUpdated(self, geom):
		'''
			Is called when a geom is updated.
			
			@param geom: Geom that was updated.
		'''
		pass
	
	
	def GeomRemoved(self, geom):
		'''
			Is called when a geom is removed.
			
			@param geom: Geom that was updated.
		'''
		pass
	
	
	def GeomHighlighted(self, geom):
		'''
			Is called when a geom is highlighted.
			
			@param geom: Geom that was updated.
		'''
		pass
	
	
	def GeomPicked(self, geom):
		'''
			Is called when a geom is picked.
			
			@param geom: Geom that was highlighted.
		'''
		pass
	
	
	#####
	# Level 2: More Refined Geom Events
	#####
	
	#
	def GeomPositionUpdated(self, geom):
		'''
			Is called when the positon of a geom is updated.
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomScaleUpdated(self, geom):
		'''
			Is called when the scale of a geom is updated.
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomOrientationUpdated(self, geom):
		'''
			Is called when the orientation of geom is updated.
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomColorUpdated(self, geom):
		'''
			Is called when the color of a geom is updated.
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomOpacityUpdated(self, geom):
		'''
			Is called when the opacity of a geom is updated.
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomVisibilityUpdated(self, geom):
		'''
			Is called when the visibility of a geom is updated.
			
			@param geom: Updated geom.
		'''
		pass
		
		
	#
	def GeomLabelUpdated(self, geom):
		'''
			Is called when the label of a geom is updated.
			
			@param geom: Updated geom.
		'''
		pass
	
	
	#####
	# Level 3: Most Refined Geom Events
	#####
	
	#
	def GeomPositionXUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
		
	#
	def GeomPositionYUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomPositionZUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomScaleXUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
		
	#
	def GeomScaleYUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomScaleZUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
	
	
	#
	def GeomOrientationXUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
		
	#
	def GeomOrientationYUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomOrientationZUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomColorRUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
		
	#
	def GeomColorGUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#
	def GeomColorBUpdated(self, geom):
		'''
			Detailed level 3 event. 
			
			@param geom: Updated geom.
		'''
		pass
		
	
	#####
	# Level 1: Instrument Event Listeners
	#####
	
	#
	def _instrumentAdded(self, message):
		
		self.InstrumentAdded(message.data)
	
	
	#
	def _instrumentUpdated(self, message):
		
		self.InstrumentUpdated(message.data)
	
	
	#
	def _instrumentRemoved(self, message):
	
		self.InstrumentRemoved(message.data)
	
	
	#
	def _instrumentStartRecording(self, message):
		self.InstrumentStartRecording(message.data)
	
	
	#
	def _instrumentStopRecording(self, message):
	
		self.InstrumentStopRecording(message.data)
	
	
	#####
	# Level 2: More Refined Instrument Events
	#####
	
	#
	def _instrumentPositionUpdated(self, message):
		
		self.InstrumentPositionUpdated(message.data)
		
	
	#
	def _instrumentScaleUpdated(self, message):
		
		self.InstrumentScaleUpdated(message.data)
		
	
	#
	def _instrumentOrientationUpdated(self, message):
		
		self.InstrumentOrientationUpdated(message.data)
		
	
	#
	def _instrumentColorUpdated(self, message):
		
		self.InstrumentColorUpdated(message.data)
		
	
	#
	def _instrumentOpacityUpdated(self, message):
		
		self.InstrumentOpacityUpdated(message.data)
		
	
	#
	def _instrumentVisibilityUpdated(self, message):
		
		self.InstrumentVisibilityUpdated(message.data)
		
		
	#
	def _instrumentLabelUpdated(self, message):
		
		self.InstrumentLabelUpdated(message.data)
	
	
	#####
	# Level 3: Most Refined Instrument Events
	#####
	
	#
	def _instrumentPositionXUpdated(self, message):
		
		self.InstrumentPositionXUpdated(message.data)
		
		
	#
	def _instrumentPositionYUpdated(self, message):
		
		self.InstrumentPositionYUpdated(message.data)
		
	
	#
	def _instrumentPositionZUpdated(self, message):
		
		self.InstrumentPositionZUpdated(message.data)
		
	
	#
	def _instrumentScaleXUpdated(self, message):
		
		self.InstrumentScaleXUpdated(message.data)
		
		
	#
	def _instrumentScaleYUpdated(self, message):
		
		self.InstrumentScaleYUpdated(message.data)
		
	
	#
	def _instrumentScaleZUpdated(self, message):
		
		self.InstrumentScaleZUpdated(message.data)
	
	
	#
	def _instrumentOrientationXUpdated(self, message):
		
		self.InstrumentOrientationXUpdated(message.data)
		
		
	#
	def _instrumentOrientationYUpdated(self, message):
		
		self.InstrumentOrientationYUpdated(message.data)
		
	
	#
	def _instrumentOrientationZUpdated(self, message):
		
		self.InstrumentOrientationZUpdated(message.data)
		
	
	#
	def _instrumentColorRUpdated(self, message):
		
		self.InstrumentColorRUpdated(message.data)
		
		
	#
	def _instrumentColorGUpdated(self, message):
		
		self.InstrumentColorGUpdated(message.data)
		
	
	#
	def _instrumentColorBUpdated(self, message):
		
		self.InstrumentColorBUpdated(message.data)
	
	
	#####
	# Level 1: Coarse Geom Event Listeners
	#####
		
	#
	def _geomAdded(self, message):
		
		self.GeomAdded(message.data)
	
	
	#
	def _geomUpdated(self, message):
		
		self.GeomUpdated(message.data)
	
	
	#
	def _geomRemoved(self, message):
		
		self.GeomRemoved(message.data)
	
	
	#
	def _geomHighlighted(self, message):
		
		self.GeomHighlighted(message.data)
	
	
	#
	def _geomPicked(self, message):
		
		self.GeomPicked(message.data)
	
	
	#####
	# Level 2: More Refined Geom Events
	#####
	
	#
	def _geomPositionUpdated(self, message):
		
		self.GeomPositionUpdated(message.data)
		
	
	#
	def _geomScaleUpdated(self, message):
		
		self.GeomScaleUpdated(message.data)
		
	
	#
	def _geomOrientationUpdated(self, message):
		
		self.GeomOrientationUpdated(message.data)
		
	
	#
	def _geomColorUpdated(self, message):
		
		self.GeomColorUpdated(message.data)
		
	
	#
	def _geomOpacityUpdated(self, message):
		
		self.GeomOpacityUpdated(message.data)
		
	
	#
	def _geomVisibilityUpdated(self, message):
		
		self.GeomVisibilityUpdated(message.data)
		
		
	#
	def _geomLabelUpdated(self, message):
		
		self.GeomLabelUpdated(message.data)
	
	
	#####
	# Level 3: Most Refined Geom Events
	#####
	
	#
	def _geomPositionXUpdated(self, message):
		
		self.GeomPositionXUpdated(message.data)
		
		
	#
	def _geomPositionYUpdated(self, message):
		
		self.GeomPositionYUpdated(message.data)
		
	
	#
	def _geomPositionZUpdated(self, message):
		
		self.GeomPositionZUpdated(message.data)
		
	
	#
	def _geomScaleXUpdated(self, message):
		
		self.GeomScaleXUpdated(message.data)
		
		
	#
	def _geomScaleYUpdated(self, message):
		
		self.GeomScaleYUpdated(message.data)
		
	
	#
	def _geomScaleZUpdated(self, message):
		
		self.GeomScaleZUpdated(message.data)
	
	
	#
	def _geomOrientationXUpdated(self, message):
		
		self.GeomOrientationXUpdated(message.data)
		
		
	#
	def _geomOrientationYUpdated(self, message):
		
		self.GeomOrientationYUpdated(message.data)
		
	
	#
	def _geomOrientationZUpdated(self, message):
		
		self.GeomOrientationZUpdated(message.data)
		
	
	#
	def _geomColorRUpdated(self, message):
		
		self.GeomColorRUpdated(message.data)
		
		
	#
	def _geomColorGUpdated(self, message):
		
		self.GeomColorGUpdated(message.data)
		
	
	#
	def _geomColorBUpdated(self, message):
		
		self.GeomColorBUpdated(message.data)
	
	